
<form class="layui-form page-form" action="{:url()}" method="post" id="editForm" enctype="multipart/form-data">
        <div class="layui-form-item">
            <label class="layui-form-label">作者</label>
            <div class="layui-input-inline w300">
                <input type="text" class="layui-input field-author" name="author" lay-verify="required" autocomplete="off">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">标题</label>
            <div class="layui-input-inline w300">
                <input type="text" class="layui-input field-title" name="title" lay-verify="required" autocomplete="off">
            </div>
        </div>

        <div class="layui-form-item upload">
            <label class="layui-form-label">作者头像</label>
            <button type="button" name="upload" class="layui-btn layui-btn-primary layui-upload" lay-type="image"
                    lay-data="{ exts:'jpg|png|gif|jpeg|ico', accept:'image'}">请上传图片</button>
            <!--<input class="layui-upload-file" type="file" accept="" name="file">-->
            <input type="hidden" class="upload-input field-avatar" name="avatar">
            <img src="" style="display:none;border-radius:5px;border:1px solid #ccc" width="36" height="36">
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">简介</label>
            <div class="layui-input-inline w300">
                <div class="layui-input-inline w300">
                    <textarea rows="6"  class="layui-textarea field-content" name="content" lay-verify="required" autocomplete="off"></textarea>
                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">文章内容</label>
            <div class="layui-input-inline w600">
                <textarea id="editor-detail"  class="layui-textarea field-detail" name="detail" lay-verify="required" autocomplete="off"></textarea>
            </div>
        </div>

        <div class="layui-form-item upload">
            <label class="layui-form-label">文章外图片</label>
            <button type="button" name="upload" class="layui-btn layui-btn-primary layui-upload" lay-type="image"
                    lay-data="{ exts:'jpg|png|gif|jpeg|ico', accept:'image'}">请上传图片</button>
            <!--<input class="layui-upload-file" type="file" accept="" name="file">-->
            <input type="hidden" class="upload-input field-imgSrc" name="imgSrc" value="">
            <img src="" style="display:none;border-radius:5px;border:1px solid #ccc" width="200" height="100">
        </div>

        <div class="layui-form-item upload">
            <label class="layui-form-label">文章内图片</label>
            <button type="button" name="upload" class="layui-btn layui-btn-primary layui-upload" lay-type="image"
                    lay-data="{ exts:'jpg|png|gif|jpeg|ico', accept:'image'}">请上传图片</button>
            <!--<input class="layui-upload-file" type="file" accept="" name="file">-->
            <input type="hidden" class="upload-input field-headImgSrc" name="headImgSrc" value="">
            <img src="" style="display:none;border-radius:5px;border:1px solid #ccc" width="200" height="100">
        </div>


        <div class="layui-form-item">
            <label class="layui-form-label">配置状态</label>
            <div class="layui-input-inline w300">
                <input type="radio" class="field-status" name="status" value="1" title="启用" checked>
                <input type="radio" class="field-status" name="status" value="0" title="禁用">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label"> </label>
            <div class="layui-input-block">
                <input type="hidden" class="field-id" name="id">
                <button type="submit" class="layui-btn layui-btn-normal" lay-submit="" lay-filter="formSubmit">提交</button>
                <a href="{:url('article')}" class="layui-btn layui-btn-primary ml10"><i class="aicon ai-fanhui"></i>返回</a>
            </div>
        </div>
    </form>
    {include file="block/layui" /}
    {php}
    echo editor(['editor-detail']);
    {/php}
    <script>
    layui.use(['form', 'func','upload'], function() {
        var $ = layui.jquery,
            form = layui.form,
            upload = layui.upload;
        layui.func.assign({:json_encode($formData)});
        form.on('select(group)', function(data) {
            $('#groupShow').html(data.value);
        });

        upload.render({
            elem: '.layui-upload',
            url: '/admin.php/system/annex/upload/thumb/no/water/no.html'
            ,method: 'post'
            ,before: function(input) {
                layer.msg('文件上传中...', {time:3000000});
            },done: function(res, index, upload) {
                var obj = this.item;
                if (res.code == 0) {
                    layer.msg(res.msg);
                    return false;
                }
                layer.closeAll();
                var input = $(obj).parents('.upload').find('.upload-input');
                if ($(obj).attr('lay-type') == 'image') {
                    input.siblings('img').attr('src', res.data.file).show();
                }
                input.val('http://www.hisicms.com'+ res.data.file);
            }
        });
    });
    </script>